home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Python 1.3 / source code / Doc / ref4.tex < prev    next >
LaTeX Document  |  1995-12-17  |  7.3 KB  |  [TEXT/R*ch]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: LaTeX Document (document/latex).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text, with CR line terminators default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[CR] default (weak)


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[R*ch]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 63 68 61 70 74 65 72 | 7b 45 78 65 63 75 74 69 |\chapter|{Executi|
|00000010| 6f 6e 20 6d 6f 64 65 6c | 7d 0d 5c 69 6e 64 65 78 |on model|}.\index|
|00000020| 7b 65 78 65 63 75 74 69 | 6f 6e 20 6d 6f 64 65 6c |{executi|on model|
|00000030| 7d 0d 0d 5c 73 65 63 74 | 69 6f 6e 7b 43 6f 64 65 |}..\sect|ion{Code|
|00000040| 20 62 6c 6f 63 6b 73 2c | 20 65 78 65 63 75 74 69 | blocks,| executi|
|00000050| 6f 6e 20 66 72 61 6d 65 | 73 2c 20 61 6e 64 20 6e |on frame|s, and n|
|00000060| 61 6d 65 20 73 70 61 63 | 65 73 7d 20 5c 6c 61 62 |ame spac|es} \lab|
|00000070| 65 6c 7b 65 78 65 63 66 | 72 61 6d 65 73 7d 0d 5c |el{execf|rames}.\|
|00000080| 69 6e 64 65 78 7b 63 6f | 64 65 20 62 6c 6f 63 6b |index{co|de block|
|00000090| 7d 0d 5c 69 6e 64 65 78 | 69 69 7b 65 78 65 63 75 |}.\index|ii{execu|
|000000a0| 74 69 6f 6e 7d 7b 66 72 | 61 6d 65 7d 0d 5c 69 6e |tion}{fr|ame}.\in|
|000000b0| 64 65 78 7b 6e 61 6d 65 | 20 73 70 61 63 65 7d 0d |dex{name| space}.|
|000000c0| 0d 41 20 7b 5c 65 6d 20 | 63 6f 64 65 20 62 6c 6f |.A {\em |code blo|
|000000d0| 63 6b 7d 20 69 73 20 61 | 20 70 69 65 63 65 20 6f |ck} is a| piece o|
|000000e0| 66 20 50 79 74 68 6f 6e | 20 70 72 6f 67 72 61 6d |f Python| program|
|000000f0| 20 74 65 78 74 20 74 68 | 61 74 20 63 61 6e 20 62 | text th|at can b|
|00000100| 65 0d 65 78 65 63 75 74 | 65 64 20 61 73 20 61 20 |e.execut|ed as a |
|00000110| 75 6e 69 74 2c 20 73 75 | 63 68 20 61 73 20 61 20 |unit, su|ch as a |
|00000120| 6d 6f 64 75 6c 65 2c 20 | 61 20 63 6c 61 73 73 20 |module, |a class |
|00000130| 64 65 66 69 6e 69 74 69 | 6f 6e 20 6f 72 20 61 20 |definiti|on or a |
|00000140| 66 75 6e 63 74 69 6f 6e | 0d 62 6f 64 79 2e 20 20 |function|.body. |
|00000150| 53 6f 6d 65 20 63 6f 64 | 65 20 62 6c 6f 63 6b 73 |Some cod|e blocks|
|00000160| 20 28 6c 69 6b 65 20 6d | 6f 64 75 6c 65 73 29 20 | (like m|odules) |
|00000170| 61 72 65 20 65 78 65 63 | 75 74 65 64 20 6f 6e 6c |are exec|uted onl|
|00000180| 79 20 6f 6e 63 65 2c 20 | 6f 74 68 65 72 73 0d 28 |y once, |others.(|
|00000190| 6c 69 6b 65 20 66 75 6e | 63 74 69 6f 6e 20 62 6f |like fun|ction bo|
|000001a0| 64 69 65 73 29 20 6d 61 | 79 20 62 65 20 65 78 65 |dies) ma|y be exe|
|000001b0| 63 75 74 65 64 20 6d 61 | 6e 79 20 74 69 6d 65 73 |cuted ma|ny times|
|000001c0| 2e 20 20 43 6f 64 65 20 | 62 6c 6f 63 6b 73 20 6d |. Code |blocks m|
|000001d0| 61 79 0d 74 65 78 74 75 | 61 6c 6c 79 20 63 6f 6e |ay.textu|ally con|
|000001e0| 74 61 69 6e 20 6f 74 68 | 65 72 20 63 6f 64 65 20 |tain oth|er code |
|000001f0| 62 6c 6f 63 6b 73 2e 20 | 20 43 6f 64 65 20 62 6c |blocks. | Code bl|
|00000200| 6f 63 6b 73 20 6d 61 79 | 20 69 6e 76 6f 6b 65 20 |ocks may| invoke |
|00000210| 6f 74 68 65 72 0d 63 6f | 64 65 20 62 6c 6f 63 6b |other.co|de block|
|00000220| 73 20 28 74 68 61 74 20 | 6d 61 79 20 6f 72 20 6d |s (that |may or m|
|00000230| 61 79 20 6e 6f 74 20 62 | 65 20 74 65 78 74 75 61 |ay not b|e textua|
|00000240| 6c 6c 79 20 63 6f 6e 74 | 61 69 6e 65 64 20 69 6e |lly cont|ained in|
|00000250| 20 74 68 65 6d 29 20 61 | 73 0d 70 61 72 74 20 6f | them) a|s.part o|
|00000260| 66 20 74 68 65 69 72 20 | 65 78 65 63 75 74 69 6f |f their |executio|
|00000270| 6e 2c 20 65 2e 67 2e 20 | 62 79 20 69 6e 76 6f 6b |n, e.g. |by invok|
|00000280| 69 6e 67 20 28 63 61 6c | 6c 69 6e 67 29 20 61 20 |ing (cal|ling) a |
|00000290| 66 75 6e 63 74 69 6f 6e | 2e 0d 5c 69 6e 64 65 78 |function|..\index|
|000002a0| 7b 63 6f 64 65 20 62 6c | 6f 63 6b 7d 0d 5c 69 6e |{code bl|ock}.\in|
|000002b0| 64 65 78 69 69 7b 63 6f | 64 65 7d 7b 62 6c 6f 63 |dexii{co|de}{bloc|
|000002c0| 6b 7d 0d 0d 54 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |k}..The |followin|
|000002d0| 67 20 61 72 65 20 63 6f | 64 65 20 62 6c 6f 63 6b |g are co|de block|
|000002e0| 73 3a 20 20 41 20 6d 6f | 64 75 6c 65 20 69 73 20 |s: A mo|dule is |
|000002f0| 61 20 63 6f 64 65 20 62 | 6c 6f 63 6b 2e 20 20 41 |a code b|lock. A|
|00000300| 20 66 75 6e 63 74 69 6f | 6e 0d 62 6f 64 79 20 69 | functio|n.body i|
|00000310| 73 20 61 20 63 6f 64 65 | 20 62 6c 6f 63 6b 2e 20 |s a code| block. |
|00000320| 20 41 20 63 6c 61 73 73 | 20 64 65 66 69 6e 69 74 | A class| definit|
|00000330| 69 6f 6e 20 69 73 20 61 | 20 63 6f 64 65 20 62 6c |ion is a| code bl|
|00000340| 6f 63 6b 2e 20 20 45 61 | 63 68 0d 63 6f 6d 6d 61 |ock. Ea|ch.comma|
|00000350| 6e 64 20 74 79 70 65 64 | 20 69 6e 74 65 72 61 63 |nd typed| interac|
|00000360| 74 69 76 65 6c 79 20 69 | 73 20 61 20 73 65 70 61 |tively i|s a sepa|
|00000370| 72 61 74 65 20 63 6f 64 | 65 20 62 6c 6f 63 6b 3b |rate cod|e block;|
|00000380| 20 61 20 73 63 72 69 70 | 74 20 66 69 6c 65 20 69 | a scrip|t file i|
|00000390| 73 0d 61 20 63 6f 64 65 | 20 62 6c 6f 63 6b 2e 20 |s.a code| block. |
|000003a0| 20 54 68 65 20 73 74 72 | 69 6e 67 20 61 72 67 75 | The str|ing argu|
|000003b0| 6d 65 6e 74 20 70 61 73 | 73 65 64 20 74 6f 20 74 |ment pas|sed to t|
|000003c0| 68 65 20 62 75 69 6c 74 | 2d 69 6e 20 66 75 6e 63 |he built|-in func|
|000003d0| 74 69 6f 6e 0d 5c 76 65 | 72 62 40 65 76 61 6c 40 |tion.\ve|rb@eval@|
|000003e0| 20 61 6e 64 20 74 6f 20 | 74 68 65 20 5c 76 65 72 | and to |the \ver|
|000003f0| 62 40 65 78 65 63 40 20 | 73 74 61 74 65 6d 65 6e |b@exec@ |statemen|
|00000400| 74 20 61 72 65 20 63 6f | 64 65 20 62 6c 6f 63 6b |t are co|de block|
|00000410| 73 2e 0d 41 6e 64 20 66 | 69 6e 61 6c 6c 79 2c 20 |s..And f|inally, |
|00000420| 74 68 65 0d 65 78 70 72 | 65 73 73 69 6f 6e 20 72 |the.expr|ession r|
|00000430| 65 61 64 20 61 6e 64 20 | 65 76 61 6c 75 61 74 65 |ead and |evaluate|
|00000440| 64 20 62 79 20 74 68 65 | 20 62 75 69 6c 74 2d 69 |d by the| built-i|
|00000450| 6e 20 66 75 6e 63 74 69 | 6f 6e 20 5c 76 65 72 62 |n functi|on \verb|
|00000460| 40 69 6e 70 75 74 40 20 | 69 73 0d 61 20 63 6f 64 |@input@ |is.a cod|
|00000470| 65 20 62 6c 6f 63 6b 2e | 0d 0d 41 20 63 6f 64 65 |e block.|..A code|
|00000480| 20 62 6c 6f 63 6b 20 69 | 73 20 65 78 65 63 75 74 | block i|s execut|
|00000490| 65 64 20 69 6e 20 61 6e | 20 65 78 65 63 75 74 69 |ed in an| executi|
|000004a0| 6f 6e 20 66 72 61 6d 65 | 2e 20 20 41 6e 20 7b 5c |on frame|. An {\|
|000004b0| 65 6d 20 65 78 65 63 75 | 74 69 6f 6e 0d 66 72 61 |em execu|tion.fra|
|000004c0| 6d 65 7d 20 63 6f 6e 74 | 61 69 6e 73 20 73 6f 6d |me} cont|ains som|
|000004d0| 65 20 61 64 6d 69 6e 69 | 73 74 72 61 74 69 76 65 |e admini|strative|
|000004e0| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 28 75 73 | informa|tion (us|
|000004f0| 65 64 20 66 6f 72 20 64 | 65 62 75 67 67 69 6e 67 |ed for d|ebugging|
|00000500| 29 2c 0d 64 65 74 65 72 | 6d 69 6e 65 73 20 77 68 |),.deter|mines wh|
|00000510| 65 72 65 20 61 6e 64 20 | 68 6f 77 20 65 78 65 63 |ere and |how exec|
|00000520| 75 74 69 6f 6e 20 63 6f | 6e 74 69 6e 75 65 73 20 |ution co|ntinues |
|00000530| 61 66 74 65 72 20 74 68 | 65 20 63 6f 64 65 20 62 |after th|e code b|
|00000540| 6c 6f 63 6b 27 73 0d 65 | 78 65 63 75 74 69 6f 6e |lock's.e|xecution|
|00000550| 20 68 61 73 20 63 6f 6d | 70 6c 65 74 65 64 2c 20 | has com|pleted, |
|00000560| 61 6e 64 20 28 70 65 72 | 68 61 70 73 20 6d 6f 73 |and (per|haps mos|
|00000570| 74 20 69 6d 70 6f 72 74 | 61 6e 74 6c 79 29 20 64 |t import|antly) d|
|00000580| 65 66 69 6e 65 73 20 74 | 77 6f 0d 6e 61 6d 65 20 |efines t|wo.name |
|00000590| 73 70 61 63 65 73 2c 20 | 74 68 65 20 6c 6f 63 61 |spaces, |the loca|
|000005a0| 6c 20 61 6e 64 20 74 68 | 65 20 67 6c 6f 62 61 6c |l and th|e global|
|000005b0| 20 6e 61 6d 65 20 73 70 | 61 63 65 2c 20 74 68 61 | name sp|ace, tha|
|000005c0| 74 20 61 66 66 65 63 74 | 0d 65 78 65 63 75 74 69 |t affect|.executi|
|000005d0| 6f 6e 20 6f 66 20 74 68 | 65 20 63 6f 64 65 20 62 |on of th|e code b|
|000005e0| 6c 6f 63 6b 2e 0d 5c 69 | 6e 64 65 78 69 69 7b 65 |lock..\i|ndexii{e|
|000005f0| 78 65 63 75 74 69 6f 6e | 7d 7b 66 72 61 6d 65 7d |xecution|}{frame}|
|00000600| 0d 0d 41 20 7b 5c 65 6d | 20 6e 61 6d 65 20 73 70 |..A {\em| name sp|
|00000610| 61 63 65 7d 20 69 73 20 | 61 20 6d 61 70 70 69 6e |ace} is |a mappin|
|00000620| 67 20 66 72 6f 6d 20 6e | 61 6d 65 73 20 28 69 64 |g from n|ames (id|
|00000630| 65 6e 74 69 66 69 65 72 | 73 29 20 74 6f 20 6f 62 |entifier|s) to ob|
|00000640| 6a 65 63 74 73 2e 0d 41 | 20 70 61 72 74 69 63 75 |jects..A| particu|
|00000650| 6c 61 72 20 6e 61 6d 65 | 20 73 70 61 63 65 20 6d |lar name| space m|
|00000660| 61 79 20 62 65 20 72 65 | 66 65 72 65 6e 63 65 64 |ay be re|ferenced|
|00000670| 20 62 79 20 6d 6f 72 65 | 20 74 68 61 6e 20 6f 6e | by more| than on|
|00000680| 65 20 65 78 65 63 75 74 | 69 6f 6e 0d 66 72 61 6d |e execut|ion.fram|
|00000690| 65 2c 20 61 6e 64 20 66 | 72 6f 6d 20 6f 74 68 65 |e, and f|rom othe|
|000006a0| 72 20 70 6c 61 63 65 73 | 20 61 73 20 77 65 6c 6c |r places| as well|
|000006b0| 2e 20 20 41 64 64 69 6e | 67 20 61 20 6e 61 6d 65 |. Addin|g a name|
|000006c0| 20 74 6f 20 61 20 6e 61 | 6d 65 20 73 70 61 63 65 | to a na|me space|
|000006d0| 0d 69 73 20 63 61 6c 6c | 65 64 20 7b 5c 65 6d 20 |.is call|ed {\em |
|000006e0| 62 69 6e 64 69 6e 67 7d | 20 61 20 6e 61 6d 65 20 |binding}| a name |
|000006f0| 28 74 6f 20 61 6e 20 6f | 62 6a 65 63 74 29 3b 20 |(to an o|bject); |
|00000700| 63 68 61 6e 67 69 6e 67 | 20 74 68 65 20 6d 61 70 |changing| the map|
|00000710| 70 69 6e 67 20 6f 66 0d | 61 20 6e 61 6d 65 20 69 |ping of.|a name i|
|00000720| 73 20 63 61 6c 6c 65 64 | 20 7b 5c 65 6d 20 72 65 |s called| {\em re|
|00000730| 62 69 6e 64 69 6e 67 7d | 3b 20 72 65 6d 6f 76 69 |binding}|; removi|
|00000740| 6e 67 20 61 20 6e 61 6d | 65 20 69 73 20 7b 5c 65 |ng a nam|e is {\e|
|00000750| 6d 20 75 6e 62 69 6e 64 | 69 6e 67 7d 2e 0d 4e 61 |m unbind|ing}..Na|
|00000760| 6d 65 20 73 70 61 63 65 | 73 20 61 72 65 20 66 75 |me space|s are fu|
|00000770| 6e 63 74 69 6f 6e 61 6c | 6c 79 20 65 71 75 69 76 |nctional|ly equiv|
|00000780| 61 6c 65 6e 74 20 74 6f | 20 64 69 63 74 69 6f 6e |alent to| diction|
|00000790| 61 72 69 65 73 2e 0d 5c | 69 6e 64 65 78 7b 6e 61 |aries..\|index{na|
|000007a0| 6d 65 20 73 70 61 63 65 | 7d 0d 5c 69 6e 64 65 78 |me space|}.\index|
|000007b0| 69 69 7b 62 69 6e 64 69 | 6e 67 7d 7b 6e 61 6d 65 |ii{bindi|ng}{name|
|000007c0| 7d 0d 5c 69 6e 64 65 78 | 69 69 7b 72 65 62 69 6e |}.\index|ii{rebin|
|000007d0| 64 69 6e 67 7d 7b 6e 61 | 6d 65 7d 0d 5c 69 6e 64 |ding}{na|me}.\ind|
|000007e0| 65 78 69 69 7b 75 6e 62 | 69 6e 64 69 6e 67 7d 7b |exii{unb|inding}{|
|000007f0| 6e 61 6d 65 7d 0d 0d 54 | 68 65 20 7b 5c 65 6d 20 |name}..T|he {\em |
|00000800| 6c 6f 63 61 6c 20 6e 61 | 6d 65 20 73 70 61 63 65 |local na|me space|
|00000810| 7d 20 6f 66 20 61 6e 20 | 65 78 65 63 75 74 69 6f |} of an |executio|
|00000820| 6e 20 66 72 61 6d 65 20 | 64 65 74 65 72 6d 69 6e |n frame |determin|
|00000830| 65 73 20 74 68 65 20 64 | 65 66 61 75 6c 74 0d 70 |es the d|efault.p|
|00000840| 6c 61 63 65 20 77 68 65 | 72 65 20 6e 61 6d 65 73 |lace whe|re names|
|00000850| 20 61 72 65 20 64 65 66 | 69 6e 65 64 20 61 6e 64 | are def|ined and|
|00000860| 20 73 65 61 72 63 68 65 | 64 2e 20 20 54 68 65 20 | searche|d. The |
|00000870| 7b 5c 65 6d 20 67 6c 6f | 62 61 6c 20 6e 61 6d 65 |{\em glo|bal name|
|00000880| 0d 73 70 61 63 65 7d 20 | 64 65 74 65 72 6d 69 6e |.space} |determin|
|00000890| 65 73 20 74 68 65 20 70 | 6c 61 63 65 20 77 68 65 |es the p|lace whe|
|000008a0| 72 65 20 6e 61 6d 65 73 | 20 6c 69 73 74 65 64 20 |re names| listed |
|000008b0| 69 6e 20 5c 76 65 72 62 | 40 67 6c 6f 62 61 6c 40 |in \verb|@global@|
|000008c0| 0d 73 74 61 74 65 6d 65 | 6e 74 73 20 61 72 65 20 |.stateme|nts are |
|000008d0| 64 65 66 69 6e 65 64 20 | 61 6e 64 20 73 65 61 72 |defined |and sear|
|000008e0| 63 68 65 64 2c 20 61 6e | 64 20 77 68 65 72 65 20 |ched, an|d where |
|000008f0| 6e 61 6d 65 73 20 74 68 | 61 74 20 61 72 65 20 6e |names th|at are n|
|00000900| 6f 74 0d 65 78 70 6c 69 | 63 69 74 6c 79 20 62 6f |ot.expli|citly bo|
|00000910| 75 6e 64 20 69 6e 20 74 | 68 65 20 63 75 72 72 65 |und in t|he curre|
|00000920| 6e 74 20 63 6f 64 65 20 | 62 6c 6f 63 6b 20 61 72 |nt code |block ar|
|00000930| 65 20 73 65 61 72 63 68 | 65 64 2e 0d 5c 69 6e 64 |e search|ed..\ind|
|00000940| 65 78 69 69 7b 6c 6f 63 | 61 6c 7d 7b 6e 61 6d 65 |exii{loc|al}{name|
|00000950| 20 73 70 61 63 65 7d 0d | 5c 69 6e 64 65 78 69 69 | space}.|\indexii|
|00000960| 7b 67 6c 6f 62 61 6c 7d | 7b 6e 61 6d 65 20 73 70 |{global}|{name sp|
|00000970| 61 63 65 7d 0d 5c 73 74 | 69 6e 64 65 78 7b 67 6c |ace}.\st|index{gl|
|00000980| 6f 62 61 6c 7d 0d 0d 57 | 68 65 74 68 65 72 20 61 |obal}..W|hether a|
|00000990| 20 6e 61 6d 65 20 69 73 | 20 6c 6f 63 61 6c 20 6f | name is| local o|
|000009a0| 72 20 67 6c 6f 62 61 6c | 20 69 6e 20 61 20 63 6f |r global| in a co|
|000009b0| 64 65 20 62 6c 6f 63 6b | 20 69 73 20 64 65 74 65 |de block| is dete|
|000009c0| 72 6d 69 6e 65 64 20 62 | 79 0d 73 74 61 74 69 63 |rmined b|y.static|
|000009d0| 20 69 6e 73 70 65 63 74 | 69 6f 6e 20 6f 66 20 74 | inspect|ion of t|
|000009e0| 68 65 20 73 6f 75 72 63 | 65 20 74 65 78 74 20 66 |he sourc|e text f|
|000009f0| 6f 72 20 74 68 65 20 63 | 6f 64 65 20 62 6c 6f 63 |or the c|ode bloc|
|00000a00| 6b 3a 20 69 6e 20 74 68 | 65 0d 61 62 73 65 6e 63 |k: in th|e.absenc|
|00000a10| 65 20 6f 66 20 5c 76 65 | 72 62 40 67 6c 6f 62 61 |e of \ve|rb@globa|
|00000a20| 6c 40 20 73 74 61 74 65 | 6d 65 6e 74 73 2c 20 61 |l@ state|ments, a|
|00000a30| 20 6e 61 6d 65 20 74 68 | 61 74 20 69 73 20 62 6f | name th|at is bo|
|00000a40| 75 6e 64 20 61 6e 79 77 | 68 65 72 65 20 69 6e 0d |und anyw|here in.|
|00000a50| 74 68 65 20 63 6f 64 65 | 20 62 6c 6f 63 6b 20 69 |the code| block i|
|00000a60| 73 20 6c 6f 63 61 6c 20 | 69 6e 20 74 68 65 20 65 |s local |in the e|
|00000a70| 6e 74 69 72 65 20 63 6f | 64 65 20 62 6c 6f 63 6b |ntire co|de block|
|00000a80| 3b 20 61 6c 6c 20 6f 74 | 68 65 72 20 6e 61 6d 65 |; all ot|her name|
|00000a90| 73 20 61 72 65 0d 63 6f | 6e 73 69 64 65 72 65 64 |s are.co|nsidered|
|00000aa0| 20 67 6c 6f 62 61 6c 2e | 20 20 54 68 65 20 5c 76 | global.| The \v|
|00000ab0| 65 72 62 40 67 6c 6f 62 | 61 6c 40 20 73 74 61 74 |erb@glob|al@ stat|
|00000ac0| 65 6d 65 6e 74 20 66 6f | 72 63 65 73 20 67 6c 6f |ement fo|rces glo|
|00000ad0| 62 61 6c 0d 69 6e 74 65 | 72 70 72 65 74 61 74 69 |bal.inte|rpretati|
|00000ae0| 6f 6e 20 6f 66 20 73 65 | 6c 65 63 74 65 64 20 6e |on of se|lected n|
|00000af0| 61 6d 65 73 20 74 68 72 | 6f 75 67 68 6f 75 74 20 |ames thr|oughout |
|00000b00| 74 68 65 20 63 6f 64 65 | 20 62 6c 6f 63 6b 2e 20 |the code| block. |
|00000b10| 20 54 68 65 0d 66 6f 6c | 6c 6f 77 69 6e 67 20 63 | The.fol|lowing c|
|00000b20| 6f 6e 73 74 72 75 63 74 | 73 20 62 69 6e 64 20 6e |onstruct|s bind n|
|00000b30| 61 6d 65 73 3a 20 66 6f | 72 6d 61 6c 20 70 61 72 |ames: fo|rmal par|
|00000b40| 61 6d 65 74 65 72 73 2c | 20 5c 76 65 72 62 40 69 |ameters,| \verb@i|
|00000b50| 6d 70 6f 72 74 40 0d 73 | 74 61 74 65 6d 65 6e 74 |mport@.s|tatement|
|00000b60| 73 2c 20 63 6c 61 73 73 | 20 61 6e 64 20 66 75 6e |s, class| and fun|
|00000b70| 63 74 69 6f 6e 20 64 65 | 66 69 6e 69 74 69 6f 6e |ction de|finition|
|00000b80| 73 20 28 74 68 65 73 65 | 20 62 69 6e 64 20 74 68 |s (these| bind th|
|00000b90| 65 20 63 6c 61 73 73 20 | 6f 72 0d 66 75 6e 63 74 |e class |or.funct|
|00000ba0| 69 6f 6e 20 6e 61 6d 65 | 29 2c 20 61 6e 64 20 74 |ion name|), and t|
|00000bb0| 61 72 67 65 74 73 20 74 | 68 61 74 20 61 72 65 20 |argets t|hat are |
|00000bc0| 69 64 65 6e 74 69 66 69 | 65 72 73 20 69 66 20 6f |identifi|ers if o|
|00000bd0| 63 63 75 72 72 69 6e 67 | 20 69 6e 20 61 6e 0d 61 |ccurring| in an.a|
|00000be0| 73 73 69 67 6e 6d 65 6e | 74 2c 20 5c 76 65 72 62 |ssignmen|t, \verb|
|00000bf0| 40 66 6f 72 40 20 6c 6f | 6f 70 20 68 65 61 64 65 |@for@ lo|op heade|
|00000c00| 72 2c 20 6f 72 20 5c 76 | 65 72 62 40 65 78 63 65 |r, or \v|erb@exce|
|00000c10| 70 74 40 20 63 6c 61 75 | 73 65 20 68 65 61 64 65 |pt@ clau|se heade|
|00000c20| 72 2e 0d 0d 41 20 74 61 | 72 67 65 74 20 6f 63 63 |r...A ta|rget occ|
|00000c30| 75 72 72 69 6e 67 20 69 | 6e 20 61 20 5c 76 65 72 |urring i|n a \ver|
|00000c40| 62 40 64 65 6c 40 20 73 | 74 61 74 65 6d 65 6e 74 |b@del@ s|tatement|
|00000c50| 20 69 73 20 61 6c 73 6f | 20 63 6f 6e 73 69 64 65 | is also| conside|
|00000c60| 72 65 64 20 62 6f 75 6e | 64 0d 66 6f 72 20 74 68 |red boun|d.for th|
|00000c70| 69 73 20 70 75 72 70 6f | 73 65 20 28 74 68 6f 75 |is purpo|se (thou|
|00000c80| 67 68 20 74 68 65 20 61 | 63 74 75 61 6c 20 73 65 |gh the a|ctual se|
|00000c90| 6d 61 6e 74 69 63 73 20 | 61 72 65 20 74 6f 20 60 |mantics |are to `|
|00000ca0| 60 75 6e 62 69 6e 64 27 | 27 20 74 68 65 0d 6e 61 |`unbind'|' the.na|
|00000cb0| 6d 65 29 2e 0d 0d 57 68 | 65 6e 20 61 20 67 6c 6f |me)...Wh|en a glo|
|00000cc0| 62 61 6c 20 6e 61 6d 65 | 20 69 73 20 6e 6f 74 20 |bal name| is not |
|00000cd0| 66 6f 75 6e 64 20 69 6e | 20 74 68 65 20 67 6c 6f |found in| the glo|
|00000ce0| 62 61 6c 20 6e 61 6d 65 | 20 73 70 61 63 65 2c 20 |bal name| space, |
|00000cf0| 69 74 20 69 73 0d 73 65 | 61 72 63 68 65 64 20 69 |it is.se|arched i|
|00000d00| 6e 20 74 68 65 20 6c 69 | 73 74 20 6f 66 20 60 60 |n the li|st of ``|
|00000d10| 62 75 69 6c 74 2d 69 6e | 27 27 20 6e 61 6d 65 73 |built-in|'' names|
|00000d20| 20 28 77 68 69 63 68 20 | 69 73 20 61 63 74 75 61 | (which |is actua|
|00000d30| 6c 6c 79 20 74 68 65 0d | 67 6c 6f 62 61 6c 20 6e |lly the.|global n|
|00000d40| 61 6d 65 20 73 70 61 63 | 65 20 6f 66 20 74 68 65 |ame spac|e of the|
|00000d50| 20 6d 6f 64 75 6c 65 20 | 5c 76 65 72 62 40 5f 5f | module |\verb@__|
|00000d60| 62 75 69 6c 74 69 6e 5f | 5f 40 29 2e 20 20 57 68 |builtin_|_@). Wh|
|00000d70| 65 6e 20 61 20 6e 61 6d | 65 20 69 73 20 6e 6f 74 |en a nam|e is not|
|00000d80| 0d 66 6f 75 6e 64 20 61 | 74 20 61 6c 6c 2c 20 74 |.found a|t all, t|
|00000d90| 68 65 20 5c 76 65 72 62 | 40 4e 61 6d 65 45 72 72 |he \verb|@NameErr|
|00000da0| 6f 72 40 20 65 78 63 65 | 70 74 69 6f 6e 20 69 73 |or@ exce|ption is|
|00000db0| 20 72 61 69 73 65 64 2e | 25 0d 5c 66 6f 6f 74 6e | raised.|%.\footn|
|00000dc0| 6f 74 65 7b 49 66 20 74 | 68 65 20 63 6f 64 65 20 |ote{If t|he code |
|00000dd0| 62 6c 6f 63 6b 20 63 6f | 6e 74 61 69 6e 73 20 7b |block co|ntains {|
|00000de0| 5c 74 74 20 65 78 65 63 | 7d 20 73 74 61 74 65 6d |\tt exec|} statem|
|00000df0| 65 6e 74 73 20 6f 72 20 | 74 68 65 0d 63 6f 6e 73 |ents or |the.cons|
|00000e00| 74 72 75 63 74 20 7b 5c | 74 74 20 66 72 6f 6d 20 |truct {\|tt from |
|00000e10| 5c 6c 64 6f 74 73 20 69 | 6d 70 6f 72 74 20 2a 7d |\ldots i|mport *}|
|00000e20| 2c 20 74 68 65 20 73 65 | 6d 61 6e 74 69 63 73 20 |, the se|mantics |
|00000e30| 6f 66 20 6e 61 6d 65 73 | 20 6e 6f 74 0d 65 78 70 |of names| not.exp|
|00000e40| 6c 69 63 69 74 6c 79 20 | 6d 65 6e 74 69 6f 6e 65 |licitly |mentione|
|00000e50| 64 20 69 6e 20 61 20 7b | 5c 74 74 20 67 6c 6f 62 |d in a {|\tt glob|
|00000e60| 61 6c 7d 20 73 74 61 74 | 65 6d 65 6e 74 20 63 68 |al} stat|ement ch|
|00000e70| 61 6e 67 65 20 73 75 62 | 74 6c 79 3a 20 6e 61 6d |ange sub|tly: nam|
|00000e80| 65 0d 6c 6f 6f 6b 75 70 | 20 66 69 72 73 74 20 73 |e.lookup| first s|
|00000e90| 65 61 72 63 68 65 73 20 | 74 68 65 20 6c 6f 63 61 |earches |the loca|
|00000ea0| 6c 20 6e 61 6d 65 20 73 | 70 61 63 65 2c 20 74 68 |l name s|pace, th|
|00000eb0| 65 6e 20 74 68 65 20 67 | 6c 6f 62 61 6c 20 6f 6e |en the g|lobal on|
|00000ec0| 65 2c 20 74 68 65 6e 0d | 74 68 65 20 62 75 69 6c |e, then.|the buil|
|00000ed0| 74 2d 69 6e 20 6f 6e 65 | 2e 7d 0d 5c 62 69 6d 6f |t-in one|.}.\bimo|
|00000ee0| 64 69 6e 64 65 78 7b 5f | 5f 62 75 69 6c 74 69 6e |dindex{_|_builtin|
|00000ef0| 5f 5f 7d 0d 5c 73 74 69 | 6e 64 65 78 7b 66 72 6f |__}.\sti|ndex{fro|
|00000f00| 6d 7d 0d 5c 73 74 69 6e | 64 65 78 7b 65 78 65 63 |m}.\stin|dex{exec|
|00000f10| 7d 0d 5c 73 74 69 6e 64 | 65 78 7b 67 6c 6f 62 61 |}.\stind|ex{globa|
|00000f20| 6c 7d 0d 5c 74 74 69 6e | 64 65 78 7b 4e 61 6d 65 |l}.\ttin|dex{Name|
|00000f30| 45 72 72 6f 72 7d 0d 0d | 54 68 65 20 66 6f 6c 6c |Error}..|The foll|
|00000f40| 6f 77 69 6e 67 20 74 61 | 62 6c 65 20 6c 69 73 74 |owing ta|ble list|
|00000f50| 73 20 74 68 65 20 6d 65 | 61 6e 69 6e 67 20 6f 66 |s the me|aning of|
|00000f60| 20 74 68 65 20 6c 6f 63 | 61 6c 20 61 6e 64 20 67 | the loc|al and g|
|00000f70| 6c 6f 62 61 6c 20 6e 61 | 6d 65 0d 73 70 61 63 65 |lobal na|me.space|
|00000f80| 20 66 6f 72 20 76 61 72 | 69 6f 75 73 20 74 79 70 | for var|ious typ|
|00000f90| 65 73 20 6f 66 20 63 6f | 64 65 20 62 6c 6f 63 6b |es of co|de block|
|00000fa0| 73 2e 20 20 54 68 65 20 | 6e 61 6d 65 20 73 70 61 |s. The |name spa|
|00000fb0| 63 65 20 66 6f 72 20 61 | 0d 70 61 72 74 69 63 75 |ce for a|.particu|
|00000fc0| 6c 61 72 20 6d 6f 64 75 | 6c 65 20 69 73 20 61 75 |lar modu|le is au|
|00000fd0| 74 6f 6d 61 74 69 63 61 | 6c 6c 79 20 63 72 65 61 |tomatica|lly crea|
|00000fe0| 74 65 64 20 77 68 65 6e | 20 74 68 65 20 6d 6f 64 |ted when| the mod|
|00000ff0| 75 6c 65 20 69 73 20 66 | 69 72 73 74 0d 72 65 66 |ule is f|irst.ref|
|00001000| 65 72 65 6e 63 65 64 2e | 20 20 4e 6f 74 65 20 74 |erenced.| Note t|
|00001010| 68 61 74 20 69 6e 20 61 | 6c 6d 6f 73 74 20 61 6c |hat in a|lmost al|
|00001020| 6c 20 63 61 73 65 73 2c | 20 74 68 65 20 67 6c 6f |l cases,| the glo|
|00001030| 62 61 6c 20 6e 61 6d 65 | 20 73 70 61 63 65 20 69 |bal name| space i|
|00001040| 73 0d 74 68 65 20 6e 61 | 6d 65 20 73 70 61 63 65 |s.the na|me space|
|00001050| 20 6f 66 20 74 68 65 20 | 63 6f 6e 74 61 69 6e 69 | of the |containi|
|00001060| 6e 67 20 6d 6f 64 75 6c | 65 20 2d 2d 2d 20 73 63 |ng modul|e --- sc|
|00001070| 6f 70 65 73 20 69 6e 20 | 50 79 74 68 6f 6e 20 64 |opes in |Python d|
|00001080| 6f 20 6e 6f 74 0d 6e 65 | 73 74 21 0d 0d 5c 62 65 |o not.ne|st!..\be|
|00001090| 67 69 6e 7b 63 65 6e 74 | 65 72 7d 0d 5c 62 65 67 |gin{cent|er}.\beg|
|000010a0| 69 6e 7b 74 61 62 75 6c | 61 72 7d 7b 7c 6c 7c 6c |in{tabul|ar}{|l|l|
|000010b0| 7c 6c 7c 6c 7c 7d 0d 5c | 68 6c 69 6e 65 0d 43 6f ||l|l|}.\|hline.Co|
|000010c0| 64 65 20 62 6c 6f 63 6b | 20 74 79 70 65 20 26 20 |de block| type & |
|000010d0| 47 6c 6f 62 61 6c 20 6e | 61 6d 65 20 73 70 61 63 |Global n|ame spac|
|000010e0| 65 20 26 20 4c 6f 63 61 | 6c 20 6e 61 6d 65 20 73 |e & Loca|l name s|
|000010f0| 70 61 63 65 20 26 20 4e | 6f 74 65 73 20 5c 5c 0d |pace & N|otes \\.|
|00001100| 5c 68 6c 69 6e 65 0d 4d | 6f 64 75 6c 65 20 26 20 |\hline.M|odule & |
|00001110| 6e 2e 73 2e 20 66 6f 72 | 20 74 68 69 73 20 6d 6f |n.s. for| this mo|
|00001120| 64 75 6c 65 20 26 20 73 | 61 6d 65 20 61 73 20 67 |dule & s|ame as g|
|00001130| 6c 6f 62 61 6c 20 26 20 | 5c 5c 0d 53 63 72 69 70 |lobal & |\\.Scrip|
|00001140| 74 20 26 20 6e 2e 73 2e | 20 66 6f 72 20 5c 76 65 |t & n.s.| for \ve|
|00001150| 72 62 40 5f 5f 6d 61 69 | 6e 5f 5f 40 20 26 20 73 |rb@__mai|n__@ & s|
|00001160| 61 6d 65 20 61 73 20 67 | 6c 6f 62 61 6c 20 26 20 |ame as g|lobal & |
|00001170| 5c 5c 0d 49 6e 74 65 72 | 61 63 74 69 76 65 20 63 |\\.Inter|active c|
|00001180| 6f 6d 6d 61 6e 64 20 26 | 20 6e 2e 73 2e 20 66 6f |ommand &| n.s. fo|
|00001190| 72 20 5c 76 65 72 62 40 | 5f 5f 6d 61 69 6e 5f 5f |r \verb@|__main__|
|000011a0| 40 20 26 20 73 61 6d 65 | 20 61 73 20 67 6c 6f 62 |@ & same| as glob|
|000011b0| 61 6c 20 26 20 5c 5c 0d | 43 6c 61 73 73 20 64 65 |al & \\.|Class de|
|000011c0| 66 69 6e 69 74 69 6f 6e | 20 26 20 67 6c 6f 62 61 |finition| & globa|
|000011d0| 6c 20 6e 2e 73 2e 20 6f | 66 20 63 6f 6e 74 61 69 |l n.s. o|f contai|
|000011e0| 6e 69 6e 67 20 62 6c 6f | 63 6b 20 26 20 6e 65 77 |ning blo|ck & new|
|000011f0| 20 6e 2e 73 2e 20 26 20 | 5c 5c 0d 46 75 6e 63 74 | n.s. & |\\.Funct|
|00001200| 69 6f 6e 20 62 6f 64 79 | 20 26 20 67 6c 6f 62 61 |ion body| & globa|
|00001210| 6c 20 6e 2e 73 2e 20 6f | 66 20 63 6f 6e 74 61 69 |l n.s. o|f contai|
|00001220| 6e 69 6e 67 20 62 6c 6f | 63 6b 20 26 20 6e 65 77 |ning blo|ck & new|
|00001230| 20 6e 2e 73 2e 20 26 20 | 5c 5c 0d 53 74 72 69 6e | n.s. & |\\.Strin|
|00001240| 67 20 70 61 73 73 65 64 | 20 74 6f 20 5c 76 65 72 |g passed| to \ver|
|00001250| 62 40 65 78 65 63 40 20 | 73 74 61 74 65 6d 65 6e |b@exec@ |statemen|
|00001260| 74 0d 09 26 20 67 6c 6f | 62 61 6c 20 6e 2e 73 2e |t..& glo|bal n.s.|
|00001270| 20 6f 66 20 63 6f 62 74 | 61 69 6e 69 6e 67 20 62 | of cobt|aining b|
|00001280| 6c 6f 63 6b 0d 09 09 26 | 20 6c 6f 63 61 6c 20 6e |lock...&| local n|
|00001290| 2e 73 2e 20 6f 66 20 63 | 6f 6e 74 61 69 6e 69 6e |.s. of c|ontainin|
|000012a0| 67 20 62 6c 6f 63 6b 20 | 26 20 28 31 29 20 5c 5c |g block |& (1) \\|
|000012b0| 0d 53 74 72 69 6e 67 20 | 70 61 73 73 65 64 20 74 |.String |passed t|
|000012c0| 6f 20 5c 76 65 72 62 40 | 65 76 61 6c 28 29 40 0d |o \verb@|eval()@.|
|000012d0| 09 26 20 67 6c 6f 62 61 | 6c 20 6e 2e 73 2e 20 6f |.& globa|l n.s. o|
|000012e0| 66 20 63 61 6c 6c 65 72 | 20 26 20 6c 6f 63 61 6c |f caller| & local|
|000012f0| 20 6e 2e 73 2e 20 6f 66 | 20 63 61 6c 6c 65 72 20 | n.s. of| caller |
|00001300| 26 20 28 31 29 20 5c 5c | 0d 46 69 6c 65 20 72 65 |& (1) \\|.File re|
|00001310| 61 64 20 62 79 20 5c 76 | 65 72 62 40 65 78 65 63 |ad by \v|erb@exec|
|00001320| 66 69 6c 65 28 29 40 0d | 09 26 20 67 6c 6f 62 61 |file()@.|.& globa|
|00001330| 6c 20 6e 2e 73 2e 20 6f | 66 20 63 61 6c 6c 65 72 |l n.s. o|f caller|
|00001340| 20 26 20 6c 6f 63 61 6c | 20 6e 2e 73 2e 20 6f 66 | & local| n.s. of|
|00001350| 20 63 61 6c 6c 65 72 20 | 26 20 28 31 29 20 5c 5c | caller |& (1) \\|
|00001360| 0d 45 78 70 72 65 73 73 | 69 6f 6e 20 72 65 61 64 |.Express|ion read|
|00001370| 20 62 79 20 5c 76 65 72 | 62 40 69 6e 70 75 74 40 | by \ver|b@input@|
|00001380| 0d 09 26 20 67 6c 6f 62 | 61 6c 20 6e 2e 73 2e 20 |..& glob|al n.s. |
|00001390| 6f 66 20 63 61 6c 6c 65 | 72 20 26 20 6c 6f 63 61 |of calle|r & loca|
|000013a0| 6c 20 6e 2e 73 2e 20 6f | 66 20 63 61 6c 6c 65 72 |l n.s. o|f caller|
|000013b0| 20 26 20 5c 5c 0d 5c 68 | 6c 69 6e 65 0d 5c 65 6e | & \\.\h|line.\en|
|000013c0| 64 7b 74 61 62 75 6c 61 | 72 7d 0d 5c 65 6e 64 7b |d{tabula|r}.\end{|
|000013d0| 63 65 6e 74 65 72 7d 0d | 5c 62 69 6d 6f 64 69 6e |center}.|\bimodin|
|000013e0| 64 65 78 7b 5f 5f 6d 61 | 69 6e 5f 5f 7d 0d 0d 4e |dex{__ma|in__}..N|
|000013f0| 6f 74 65 73 3a 0d 0d 5c | 62 65 67 69 6e 7b 64 65 |otes:..\|begin{de|
|00001400| 73 63 72 69 70 74 69 6f | 6e 7d 0d 0d 5c 69 74 65 |scriptio|n}..\ite|
|00001410| 6d 5b 6e 2e 73 2e 5d 20 | 6d 65 61 6e 73 20 7b 5c |m[n.s.] |means {\|
|00001420| 65 6d 20 6e 61 6d 65 20 | 73 70 61 63 65 7d 0d 0d |em name |space}..|
|00001430| 5c 69 74 65 6d 5b 28 31 | 29 5d 20 54 68 65 20 67 |\item[(1|)] The g|
|00001440| 6c 6f 62 61 6c 20 61 6e | 64 20 6c 6f 63 61 6c 20 |lobal an|d local |
|00001450| 6e 61 6d 65 20 73 70 61 | 63 65 20 66 6f 72 20 74 |name spa|ce for t|
|00001460| 68 65 73 65 20 63 61 6e | 20 62 65 0d 6f 76 65 72 |hese can| be.over|
|00001470| 72 69 64 64 65 6e 20 77 | 69 74 68 20 6f 70 74 69 |ridden w|ith opti|
|00001480| 6f 6e 61 6c 20 65 78 74 | 72 61 20 61 72 67 75 6d |onal ext|ra argum|
|00001490| 65 6e 74 73 2e 0d 0d 5c | 65 6e 64 7b 64 65 73 63 |ents...\|end{desc|
|000014a0| 72 69 70 74 69 6f 6e 7d | 0d 0d 54 68 65 20 62 75 |ription}|..The bu|
|000014b0| 69 6c 74 2d 69 6e 20 66 | 75 6e 63 74 69 6f 6e 73 |ilt-in f|unctions|
|000014c0| 20 5c 76 65 72 62 40 67 | 6c 6f 62 61 6c 73 28 29 | \verb@g|lobals()|
|000014d0| 40 20 61 6e 64 20 5c 76 | 65 72 62 40 6c 6f 63 61 |@ and \v|erb@loca|
|000014e0| 6c 73 28 29 40 20 72 65 | 74 75 72 6e 73 20 61 0d |ls()@ re|turns a.|
|000014f0| 64 69 63 74 69 6f 6e 61 | 72 79 20 72 65 70 72 65 |dictiona|ry repre|
|00001500| 73 65 6e 74 69 6e 67 20 | 74 68 65 20 63 75 72 72 |senting |the curr|
|00001510| 65 6e 74 20 67 6c 6f 62 | 61 6c 20 61 6e 64 20 6c |ent glob|al and l|
|00001520| 6f 63 61 6c 20 6e 61 6d | 65 20 73 70 61 63 65 2c |ocal nam|e space,|
|00001530| 0d 72 65 73 70 65 63 74 | 69 76 65 6c 79 2e 20 20 |.respect|ively. |
|00001540| 54 68 65 20 65 66 66 65 | 63 74 20 6f 66 20 6d 6f |The effe|ct of mo|
|00001550| 64 69 66 69 63 61 74 69 | 6f 6e 73 20 74 6f 20 74 |dificati|ons to t|
|00001560| 68 69 73 20 64 69 63 74 | 69 6f 6e 61 72 79 20 6f |his dict|ionary o|
|00001570| 6e 20 74 68 65 0d 6e 61 | 6d 65 20 73 70 61 63 65 |n the.na|me space|
|00001580| 20 61 72 65 20 75 6e 64 | 65 66 69 6e 65 64 2e 25 | are und|efined.%|
|00001590| 0d 5c 66 6f 6f 74 6e 6f | 74 65 7b 54 68 65 20 63 |.\footno|te{The c|
|000015a0| 75 72 72 65 6e 74 20 69 | 6d 70 6c 65 6d 65 6e 74 |urrent i|mplement|
|000015b0| 61 74 69 6f 6e 73 20 72 | 65 74 75 72 6e 20 74 68 |ations r|eturn th|
|000015c0| 65 20 64 69 63 74 69 6f | 6e 61 72 79 20 61 63 74 |e dictio|nary act|
|000015d0| 75 61 6c 6c 79 20 0d 75 | 73 65 64 20 74 6f 20 69 |ually .u|sed to i|
|000015e0| 6d 70 6c 65 6d 65 6e 74 | 20 74 68 65 20 6e 61 6d |mplement| the nam|
|000015f0| 65 20 73 70 61 63 65 2c | 20 7b 5c 65 6d 20 65 78 |e space,| {\em ex|
|00001600| 63 65 70 74 7d 20 66 6f | 72 20 66 75 6e 63 74 69 |cept} fo|r functi|
|00001610| 6f 6e 73 2c 20 77 68 65 | 72 65 0d 74 68 65 20 6f |ons, whe|re.the o|
|00001620| 70 74 69 6d 69 7a 65 72 | 20 6d 61 79 20 63 61 75 |ptimizer| may cau|
|00001630| 73 65 20 74 68 65 20 6c | 6f 63 61 6c 20 6e 61 6d |se the l|ocal nam|
|00001640| 65 20 73 70 61 63 65 20 | 74 6f 20 62 65 20 69 6d |e space |to be im|
|00001650| 70 6c 65 6d 65 6e 74 65 | 64 0d 64 69 66 66 65 72 |plemente|d.differ|
|00001660| 65 6e 74 6c 79 2c 20 61 | 6e 64 20 5c 76 65 72 62 |ently, a|nd \verb|
|00001670| 40 6c 6f 63 61 6c 73 28 | 29 40 20 72 65 74 75 72 |@locals(|)@ retur|
|00001680| 6e 73 20 61 20 72 65 61 | 64 2d 6f 6e 6c 79 20 64 |ns a rea|d-only d|
|00001690| 69 63 74 69 6f 6e 61 72 | 79 2e 7d 0d 0d 5c 73 65 |ictionar|y.}..\se|
|000016a0| 63 74 69 6f 6e 7b 45 78 | 63 65 70 74 69 6f 6e 73 |ction{Ex|ceptions|
|000016b0| 7d 0d 0d 45 78 63 65 70 | 74 69 6f 6e 73 20 61 72 |}..Excep|tions ar|
|000016c0| 65 20 61 20 6d 65 61 6e | 73 20 6f 66 20 62 72 65 |e a mean|s of bre|
|000016d0| 61 6b 69 6e 67 20 6f 75 | 74 20 6f 66 20 74 68 65 |aking ou|t of the|
|000016e0| 20 6e 6f 72 6d 61 6c 20 | 66 6c 6f 77 20 6f 66 20 | normal |flow of |
|000016f0| 63 6f 6e 74 72 6f 6c 0d | 6f 66 20 61 20 63 6f 64 |control.|of a cod|
|00001700| 65 20 62 6c 6f 63 6b 20 | 69 6e 20 6f 72 64 65 72 |e block |in order|
|00001710| 20 74 6f 20 68 61 6e 64 | 6c 65 20 65 72 72 6f 72 | to hand|le error|
|00001720| 73 20 6f 72 20 6f 74 68 | 65 72 20 65 78 63 65 70 |s or oth|er excep|
|00001730| 74 69 6f 6e 61 6c 0d 63 | 6f 6e 64 69 74 69 6f 6e |tional.c|ondition|
|00001740| 73 2e 20 20 41 6e 20 65 | 78 63 65 70 74 69 6f 6e |s. An e|xception|
|00001750| 20 69 73 20 7b 5c 65 6d | 20 72 61 69 73 65 64 7d | is {\em| raised}|
|00001760| 20 61 74 20 74 68 65 20 | 70 6f 69 6e 74 20 77 68 | at the |point wh|
|00001770| 65 72 65 20 74 68 65 20 | 65 72 72 6f 72 0d 69 73 |ere the |error.is|
|00001780| 20 64 65 74 65 63 74 65 | 64 3b 20 69 74 20 6d 61 | detecte|d; it ma|
|00001790| 79 20 62 65 20 7b 5c 65 | 6d 20 68 61 6e 64 6c 65 |y be {\e|m handle|
|000017a0| 64 7d 20 62 79 20 74 68 | 65 20 73 75 72 72 6f 75 |d} by th|e surrou|
|000017b0| 6e 64 69 6e 67 20 63 6f | 64 65 20 62 6c 6f 63 6b |nding co|de block|
|000017c0| 20 6f 72 0d 62 79 20 61 | 6e 79 20 63 6f 64 65 20 | or.by a|ny code |
|000017d0| 62 6c 6f 63 6b 20 74 68 | 61 74 20 64 69 72 65 63 |block th|at direc|
|000017e0| 74 6c 79 20 6f 72 20 69 | 6e 64 69 72 65 63 74 6c |tly or i|ndirectl|
|000017f0| 79 20 69 6e 76 6f 6b 65 | 64 20 74 68 65 20 63 6f |y invoke|d the co|
|00001800| 64 65 20 62 6c 6f 63 6b | 0d 77 68 65 72 65 20 74 |de block|.where t|
|00001810| 68 65 20 65 72 72 6f 72 | 20 6f 63 63 75 72 72 65 |he error| occurre|
|00001820| 64 2e 0d 5c 69 6e 64 65 | 78 7b 65 78 63 65 70 74 |d..\inde|x{except|
|00001830| 69 6f 6e 7d 0d 5c 69 6e | 64 65 78 7b 72 61 69 73 |ion}.\in|dex{rais|
|00001840| 65 20 61 6e 20 65 78 63 | 65 70 74 69 6f 6e 7d 0d |e an exc|eption}.|
|00001850| 5c 69 6e 64 65 78 7b 68 | 61 6e 64 6c 65 20 61 6e |\index{h|andle an|
|00001860| 20 65 78 63 65 70 74 69 | 6f 6e 7d 0d 5c 69 6e 64 | excepti|on}.\ind|
|00001870| 65 78 7b 65 78 63 65 70 | 74 69 6f 6e 20 68 61 6e |ex{excep|tion han|
|00001880| 64 6c 65 72 7d 0d 5c 69 | 6e 64 65 78 7b 65 72 72 |dler}.\i|ndex{err|
|00001890| 6f 72 73 7d 0d 5c 69 6e | 64 65 78 7b 65 72 72 6f |ors}.\in|dex{erro|
|000018a0| 72 20 68 61 6e 64 6c 69 | 6e 67 7d 0d 0d 54 68 65 |r handli|ng}..The|
|000018b0| 20 50 79 74 68 6f 6e 20 | 69 6e 74 65 72 70 72 65 | Python |interpre|
|000018c0| 74 65 72 20 72 61 69 73 | 65 73 20 61 6e 20 65 78 |ter rais|es an ex|
|000018d0| 63 65 70 74 69 6f 6e 20 | 77 68 65 6e 20 69 74 20 |ception |when it |
|000018e0| 64 65 74 65 63 74 73 20 | 61 6e 20 72 75 6e 2d 74 |detects |an run-t|
|000018f0| 69 6d 65 0d 65 72 72 6f | 72 20 28 73 75 63 68 20 |ime.erro|r (such |
|00001900| 61 73 20 64 69 76 69 73 | 69 6f 6e 20 62 79 20 7a |as divis|ion by z|
|00001910| 65 72 6f 29 2e 20 20 41 | 20 50 79 74 68 6f 6e 20 |ero). A| Python |
|00001920| 70 72 6f 67 72 61 6d 20 | 63 61 6e 20 61 6c 73 6f |program |can also|
|00001930| 0d 65 78 70 6c 69 63 69 | 74 6c 79 20 72 61 69 73 |.explici|tly rais|
|00001940| 65 20 61 6e 20 65 78 63 | 65 70 74 69 6f 6e 20 77 |e an exc|eption w|
|00001950| 69 74 68 20 74 68 65 20 | 5c 76 65 72 62 40 72 61 |ith the |\verb@ra|
|00001960| 69 73 65 40 20 73 74 61 | 74 65 6d 65 6e 74 2e 0d |ise@ sta|tement..|
|00001970| 45 78 63 65 70 74 69 6f | 6e 20 68 61 6e 64 6c 65 |Exceptio|n handle|
|00001980| 72 73 20 61 72 65 20 73 | 70 65 63 69 66 69 65 64 |rs are s|pecified|
|00001990| 20 77 69 74 68 20 74 68 | 65 20 5c 76 65 72 62 40 | with th|e \verb@|
|000019a0| 74 72 79 2e 2e 2e 65 78 | 63 65 70 74 40 0d 73 74 |try...ex|cept@.st|
|000019b0| 61 74 65 6d 65 6e 74 2e | 0d 0d 50 79 74 68 6f 6e |atement.|..Python|
|000019c0| 20 75 73 65 73 20 74 68 | 65 20 60 60 74 65 72 6d | uses th|e ``term|
|000019d0| 69 6e 61 74 69 6f 6e 27 | 27 20 6d 6f 64 65 6c 20 |ination'|' model |
|000019e0| 6f 66 20 65 72 72 6f 72 | 20 68 61 6e 64 6c 69 6e |of error| handlin|
|000019f0| 67 3a 20 61 6e 20 65 78 | 63 65 70 74 69 6f 6e 0d |g: an ex|ception.|
|00001a00| 68 61 6e 64 6c 65 72 20 | 63 61 6e 20 66 69 6e 64 |handler |can find|
|00001a10| 20 6f 75 74 20 77 68 61 | 74 20 68 61 70 70 65 6e | out wha|t happen|
|00001a20| 65 64 20 61 6e 64 20 63 | 6f 6e 74 69 6e 75 65 20 |ed and c|ontinue |
|00001a30| 65 78 65 63 75 74 69 6f | 6e 20 61 74 20 61 6e 20 |executio|n at an |
|00001a40| 6f 75 74 65 72 0d 6c 65 | 76 65 6c 2c 20 62 75 74 |outer.le|vel, but|
|00001a50| 20 69 74 20 63 61 6e 6e | 6f 74 20 72 65 70 61 69 | it cann|ot repai|
|00001a60| 72 20 74 68 65 20 63 61 | 75 73 65 20 6f 66 20 74 |r the ca|use of t|
|00001a70| 68 65 20 65 72 72 6f 72 | 20 61 6e 64 20 72 65 74 |he error| and ret|
|00001a80| 72 79 20 74 68 65 0d 66 | 61 69 6c 69 6e 67 20 6f |ry the.f|ailing o|
|00001a90| 70 65 72 61 74 69 6f 6e | 20 28 65 78 63 65 70 74 |peration| (except|
|00001aa0| 20 62 79 20 72 65 2d 65 | 6e 74 65 72 69 6e 67 20 | by re-e|ntering |
|00001ab0| 74 68 65 20 74 68 65 20 | 6f 66 66 65 6e 64 69 6e |the the |offendin|
|00001ac0| 67 20 70 69 65 63 65 20 | 6f 66 0d 63 6f 64 65 20 |g piece |of.code |
|00001ad0| 66 72 6f 6d 20 74 68 65 | 20 74 6f 70 29 2e 0d 0d |from the| top)...|
|00001ae0| 57 68 65 6e 20 61 6e 20 | 65 78 63 65 70 74 69 6f |When an |exceptio|
|00001af0| 6e 20 69 73 20 6e 6f 74 | 20 68 61 6e 64 6c 65 64 |n is not| handled|
|00001b00| 20 61 74 20 61 6c 6c 2c | 20 74 68 65 20 69 6e 74 | at all,| the int|
|00001b10| 65 72 70 72 65 74 65 72 | 20 74 65 72 6d 69 6e 61 |erpreter| termina|
|00001b20| 74 65 73 0d 65 78 65 63 | 75 74 69 6f 6e 20 6f 66 |tes.exec|ution of|
|00001b30| 20 74 68 65 20 70 72 6f | 67 72 61 6d 2c 20 6f 72 | the pro|gram, or|
|00001b40| 20 72 65 74 75 72 6e 73 | 20 74 6f 20 69 74 73 20 | returns| to its |
|00001b50| 69 6e 74 65 72 61 63 74 | 69 76 65 20 6d 61 69 6e |interact|ive main|
|00001b60| 20 6c 6f 6f 70 2e 0d 0d | 45 78 63 65 70 74 69 6f | loop...|Exceptio|
|00001b70| 6e 73 20 61 72 65 20 69 | 64 65 6e 74 69 66 69 65 |ns are i|dentifie|
|00001b80| 64 20 62 79 20 73 74 72 | 69 6e 67 20 6f 62 6a 65 |d by str|ing obje|
|00001b90| 63 74 73 2e 20 20 54 77 | 6f 20 64 69 66 66 65 72 |cts. Tw|o differ|
|00001ba0| 65 6e 74 20 73 74 72 69 | 6e 67 0d 6f 62 6a 65 63 |ent stri|ng.objec|
|00001bb0| 74 73 20 77 69 74 68 20 | 74 68 65 20 73 61 6d 65 |ts with |the same|
|00001bc0| 20 76 61 6c 75 65 20 69 | 64 65 6e 74 69 66 79 20 | value i|dentify |
|00001bd0| 64 69 66 66 65 72 65 6e | 74 20 65 78 63 65 70 74 |differen|t except|
|00001be0| 69 6f 6e 73 2e 0d 0d 57 | 68 65 6e 20 61 6e 20 65 |ions...W|hen an e|
|00001bf0| 78 63 65 70 74 69 6f 6e | 20 69 73 20 72 61 69 73 |xception| is rais|
|00001c00| 65 64 2c 20 61 6e 20 6f | 62 6a 65 63 74 20 28 6d |ed, an o|bject (m|
|00001c10| 61 79 62 65 20 5c 76 65 | 72 62 40 4e 6f 6e 65 40 |aybe \ve|rb@None@|
|00001c20| 29 20 69 73 20 70 61 73 | 73 65 64 0d 61 73 20 74 |) is pas|sed.as t|
|00001c30| 68 65 20 65 78 63 65 70 | 74 69 6f 6e 27 73 20 60 |he excep|tion's `|
|00001c40| 60 70 61 72 61 6d 65 74 | 65 72 27 27 3b 20 74 68 |`paramet|er''; th|
|00001c50| 69 73 20 6f 62 6a 65 63 | 74 20 64 6f 65 73 20 6e |is objec|t does n|
|00001c60| 6f 74 20 61 66 66 65 63 | 74 20 74 68 65 0d 73 65 |ot affec|t the.se|
|00001c70| 6c 65 63 74 69 6f 6e 20 | 6f 66 20 61 6e 20 65 78 |lection |of an ex|
|00001c80| 63 65 70 74 69 6f 6e 20 | 68 61 6e 64 6c 65 72 2c |ception |handler,|
|00001c90| 20 62 75 74 20 69 73 20 | 70 61 73 73 65 64 20 74 | but is |passed t|
|00001ca0| 6f 20 74 68 65 20 73 65 | 6c 65 63 74 65 64 0d 65 |o the se|lected.e|
|00001cb0| 78 63 65 70 74 69 6f 6e | 20 68 61 6e 64 6c 65 72 |xception| handler|
|00001cc0| 20 61 73 20 61 64 64 69 | 74 69 6f 6e 61 6c 20 69 | as addi|tional i|
|00001cd0| 6e 66 6f 72 6d 61 74 69 | 6f 6e 2e 0d 0d 53 65 65 |nformati|on...See|
|00001ce0| 20 61 6c 73 6f 20 74 68 | 65 20 64 65 73 63 72 69 | also th|e descri|
|00001cf0| 70 74 69 6f 6e 20 6f 66 | 20 74 68 65 20 5c 76 65 |ption of| the \ve|
|00001d00| 72 62 40 74 72 79 40 20 | 61 6e 64 20 5c 76 65 72 |rb@try@ |and \ver|
|00001d10| 62 40 72 61 69 73 65 40 | 0d 73 74 61 74 65 6d 65 |b@raise@|.stateme|
|00001d20| 6e 74 73 2e 0d | |nts.. | |
+--------+-------------------------+-------------------------+--------+--------+